package com.hnxxxy.usermgr.mapper;

import com.github.pagehelper.Page;
import com.hnxxxy.usermgr.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import java.util.List;
/**
 * @CLASSDESCRIPER:
 * @AUTHOR:suhui
 * @PHONE:13319575368
 * @EMIAL:13319575368@163.COM
 * @DATE: 2020/3/31
 * @PARAMDESCRIPER:
 * @OUTPARAMDESCRIPER:
 */
@Mapper
public interface IUserMapper {

    @Select(value = "select a.name,f_getDictValue(a.sex,'SYS_SEX') sex,a.born,f_getDictValue(a.mingzu,'SYS_MINGZU') mingzu,a.nativeplace,f_getDictValue(a.affiliation,'SYS_AFFILIATION') affiliation,f_getDictValue(a.cardtype,'SYS_CRADTYPE') cardtype,a.cardnumber,a.email,a.phonenumber,a.relname,a.relphonenumber,a.education,a.school,a.college,a.major,a.createdate " +
            " from cst_user a where a.name like  CONCAT('%',#{name},'%')")
    List<User> findUserByName(String name);

    @Select(value = "<script>" +
            "select a.name,f_getDictValue(a.sex,'SYS_SEX') sex,a.born,f_getDictValue(a.mingzu,'SYS_MINGZU') mingzu,a.nativeplace,f_getDictValue(a.affiliation,'SYS_AFFILIATION') affiliation,f_getDictValue(a.cardtype,'SYS_CRADTYPE') cardtype,a.cardnumber,a.email," +
            "a.phonenumber,a.relname,a.relphonenumber,a.education,a.school,a.college,a.major,a.createdate" +
            " from cst_user a where 1=1" +
            "</script>")
    List<User> findAllUser();

}
